package sample.boot.metrics;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

/**
 * Created on 2020/8/7
 */
@SpringBootApplication
public class MetricsApplication implements ApplicationListener<ContextRefreshedEvent> {

	@Autowired
	private MyMetrics myMetrics;
	@Autowired
	private MyMetrics2 myMetrics2;

	public static void main(String[] args) {
		SpringApplication.run(MetricsApplication.class, args);
	}

	public void onApplicationEvent(ContextRefreshedEvent event) {
		myMetrics.foo();
		myMetrics2.foo();
	}
}
